/*
 * Copyright 2015-2025 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v2.0 which
 * accompanies this distribution and is available at
 *
 * https://www.eclipse.org/legal/epl-v20.html
 */

package com.example.project;

public class Calculator {

	public int add(int a, int b) {
		return a + b;
	}

    public int divide(int a, int b) { return a / b ;}

	public int factorial(int input) {
		if (input < 0) {
			throw new IllegalArgumentException("Input must be non-negative");
		}
		int result = 1;
		for (int i = 1; i <= input; i++) {
			result *= i;
		}
		return result;
	}

	public int subtract(int a, int b) {
		return a - b;
	}
}
